<?php if(!defined('A')) exit;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站内容管理系统</title>
<?php
loadcss(array('reset','shell'));

//loadcss(array('colorbox'),P_CSS);
loadjs(array('jquery'),P_JS);

loadjs(array('tab','util','table'));

?>
<script type="text/javascript">
$(document).ready(function(e) {
var smallNowTab;
var pt = new Tabs();
pt.classpre="smalltab_";
pt.container = "smalltab_container";
pt.createTab("t1","help","",true,"n");
pt.init = function(){
	smallNowTab = pt.nowTab;
};
pt.onclick = function(){
	smallNowTab = pt.nowTab;
};		
pt.initTab();
pt.clickNowTab();    
});

$(document).ready(function(){ 
	
});



$(document).ready(function(){
	 //全选
     $("#CheckedAll").click(function(){
	     $(".select_all:checkbox").attr('checked', true);
	 });
	 //全不选
     $("#CheckedNo").click(function(){
	    $(".select_all:checkbox").attr('checked', false);
	 });
	 //反选
     $("#CheckedRev").click(function(){
		  $(".select_all:checkbox").each(function(){
			this.checked=!this.checked;
		  });
	 });
});

</script>
<style>
body{margin:10px;}
.def{display:none;}
</style>
</head>
<body>
<table class="settop">
<tr>
<td class="settop_left">
&nbsp;&nbsp;
</td>
<td>
<div id="smalltab_container"></div>
</td>
</tr>
</table>
<div class="smalltab_line"></div>
<div id="t1">
<br />
<br />

<form action="<?php echo url('other','help3');?>" method="post" id="myform">
<?php
if(!empty($fields)){
?>
<table width="90%" border="0" cellspacing="0" cellpadding="0" class="mytable">
  <tr>
    <td align="center"><input type="button" id="CheckedAll" value="yes"/>
      <input type="button" id="CheckedNo" value="no"/>
      <input type="button" id="CheckedRev" value="rev"/></td>
    <td align="center">字段名：</td>
    <td align="center">必填</td>
    <td align="center">中文名</td>
    <td align="center">表单类型</td>
    <td align="center">长度提示</td>
  </tr>
<?php
foreach($fields as $k=>$v){
?>
  <tr>
    <td align="center"><input type="checkbox" class="select_all" name="_choosed_fields[<?php echo $v['Field'];?>]" value="<?php echo $v['Field'];?>" checked="checked" /></td>
    <td align="center"><?php echo $v['Field']?>：</td>
    <td align="center">
      <input type="checkbox" name="_choosed_notnull[<?php echo $v['Field'];?>]" value="<?php echo $v['Field'];?>" />
      </td>
    <td align="center">
    <input type="text" name="_choosed_names[<?php echo $v['Field']?>]" id="<?php echo $v['Field']?>" class="input" value="<?php echo $comments[$v['Field']];?>" /></td>
    <td align="center">
    <select class="abc" name="_choosed_types[<?php echo $v['Field']?>]">
      <option value="text">文本输入框</option>
      <option value="textarea">文本域</option>
      <option value="">自定义</option>
    </select>
    <input type="text" name="_choosed_diys[<?php echo $v['Field']?>]" id="" class="def" value="" />
    </td>
    <td align="center"><input type="text" name="_choosed_lengths[<?php echo $v['Field'];?>]" id="_choosed_lengths[<?php echo $v['Field'];?>]" value="<?php echo $v['length'];?>" /></td>
  </tr>
<?php
}
?>
<script>
$(document).ready(function(e) {
    $('.abc').change(function(){
		var index=$(this).index('.abc');
		if($(this).val()){
			$('.def').eq(index).hide();
		}else{
			$('.def').eq(index).show();
		}
		return true;
	});
});
</script>
  <tr>
    <td colspan="6" align="center"><input type="submit" name="submit" value="提交" class="color_btn color_btn_green" /></td>
    </tr>
</table>
<?php
}
?>
</form>

</div>
</body>
</html>